package org.koyad.portal.displayApps.actions;

import java.util.Map;
import java.util.Set;

import org.koyad.portal.annotations.Action;
import org.koyad.portal.annotations.Action.Forward;
import org.koyad.portal.api.BaseAction;
import org.koyad.portal.constants.FrameworkConstants;
import org.koyad.portal.context.PistonContext;
import org.koyad.portal.utils.LogUtils;

@Action(
	name = "displayApps",
	forwards = { 
					@Forward(name = "success", path = "/jsp/success.jsp"),
					@Forward(name = "failure", path = "/jsp/failure.jsp")
			   }
)
public class DisplayAppsAction extends BaseAction {

	private static final LogUtils LOGGER = LogUtils.getLogger(DisplayAppsAction.class);
	
	@Override
	public void execute() {
		
		PistonContext pistonCtx = PistonContext.getContext();
		Map<String, String> actions = (Map<String, String>)pistonCtx.getApplication().getAttribute(FrameworkConstants.PISTON_ACTIONS);
		Set<String> actionKeys = actions.keySet();
		
		PistonContext.getContext().getRequest().setAttribute("actions", actionKeys);
		
		createView("/_displayApps/xml/displayApps.xml");
	}

}
